package hzst.android.form.view;

import hzst.android.view.MyDateView;
import hzst.android.view.MyDateView.OnDateTimeChangedListener;
import android.content.Context;

public class FMDateView extends FMBaseView{

	public FMDateView(Context context) {
		super(context);
	}

	@Override
	protected void initView() {
		
	}
	
	@Override
	public void showView() {
		MyDateView view = new MyDateView(context);
		String value = info.getSubmitValues().get(0).getValue();//DateView只有一个value
		((MyDateView) view).setDate(value);
		((MyDateView) view).setTimeEnable(false);
		
		if(info.isReadOnly()){
			((MyDateView) view).setEnable(false);
		}
		((MyDateView) view).setOnDateTimeChangedListener(new OnDateTimeChangedListener() {
			
			@Override
			public void dateTimeChanged(String time) {
				viewCreator.setSubmitValue(time, info);
//				viewCreator.updateViewInfo(info, true);
			}
		});
		addView(view);
	}

}
